import { fetch } from '../utils/httpRequest'
export default {
  namespace: 'home',
  state: {
    num: 0
  },
  effects: {
    *changeNum ({payload}, {select, put, call}) {
      let res = yield call(fetch('/api/AppNews/getNewsList/type/1/p/1'))
      console.log(res)
      yield put({
        type: 'saveNum',
        payload
      })
    }
  },
  reducers: {
    saveNum (state, { payload }) {
      return {
        ...state,
        ...payload,
        num: state.num + payload.num
      }
    }
  }
}